/**
* @file StaticSound.cpp
* @author Max Ocklind
* @version 2009-12-28
*
* An easy-to-use wrapper for an OpenAL static sound source with some extra sound properties:</br>
* * sound priprity</br>
* * distance culling type</br>
* * sound type</br>
* * sound effect filter with an associated timer
*
* <p><b>Note:</b> if the default constructor is used the <code>StaticSound</code> object must be
* reseted (provided with a sound source) before it can be used!</p>
**/


/* includes */

#include "StaticSound.h"


/* functions */

/**
* Sets the basic sound properties of the sound source.
*
* @param position pointer to floating point-vector
* @param velocity pointer to floating point-vector
* @param loop indicates if the sound should loop or not
* @param pitch the pitch of the sound (0.0 - ...)
* @param gain the gain (volume contribution, 0.0 - 1.0) to the over all sound output
* @param rolloffFactor specifies how fast the sound should fade with distance (0.0 - ...)
*/
void StaticSound::setProperties(ALfloat* position, ALfloat* velocity, ALboolean loop, ALfloat pitch, ALfloat gain, ALfloat rolloffFactor)
{
	Sound::setProperties(position, velocity, loop, pitch, gain, rolloffFactor);

	alSourcef(mSource, AL_ROLLOFF_FACTOR, 0.0f);
	errCheck->checkALError("StaticSound", "setProperties (static roll of factor)");

	alSourcei(mSource, AL_SOURCE_RELATIVE, AL_TRUE); 
	errCheck->checkALError("StaticSound", "setProperties (static sound)");
}

/**
* Resets the properties of the sound source and replaces the current sound source with the
* specified sound source to allow reusage of this <code>StaticSound</code>-object.
*
* @param source the new sound source to replace the current one
*/
void StaticSound::reset(SoundSource source)
{
	Sound::reset(source);
	mSoundType = STATIC_SOUND;
}

